<script type="text/javascript" charset="utf-8" src="__PUBLIC__/dest/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/dest/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/dest/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	$(document).ready(function(){


		$.formValidator.initConfig({
			formid:"userForm1",
			onerror:function(msg){
			},
			onsuccess:function(){
				
			}
		}); 
		$("#pname_cn").formValidator({empty:false, onshow:"请输入平台名称", onfocus:"范围为（2-20个字）", oncorrect:" "})
		.functionValidator({fun:function(val,elem){
			if (val.length >= 2 && val.length <= 40){
				return true;
			}else{
				return 	'输入错误';
			}
		}});
		$("#version_major").formValidator({empty:false,onshow:"请输入平台版本号",onfocus:"范围为（2-20个字）",oncorrect:" "})
		.functionValidator({fun:function(val,elem){
			if (val.length >= 2 && val.length <= 40){
				return true;
			}else{
				return 	'输入错误';
			}
		}});


		$("#web_site").formValidator({onshow:"请设置平台当前地址" ,onfocus:"如：www.test.com",oncorrect:" "})
		.functionValidator({fun:function(val,elem){

				if(!val.match(regexEnum.http)){
					return "域名格式不正确";
				}else{
					return true;	
				}
			}
		});
		window.UEDITOR_HOME_URL = '__PUBLIC__/dest/ueditor/';
		var ue = UE.getEditor('editor');
		ue.addListener("ready", function () {
		    ue.setContent('{$copyright_cn}');
		});


      	

		var imagename = "{$logo}";
		var fullbackuptab = $('#config_upload_process').html5uploader({
			fileTypeExts:'image/jpeg,image/png,image/jpg', //支持上传的后缀名，多个用逗号隔开, 填写mime类型
			auto:true,  //是否自动上传
			removeTimeout:3000,  //上传成功后，进度条多少毫秒后消失
			url:"{:U('Config/upload_img')}",
			input_file_id:'input-file-config',  //上传控件的id
			formData:{'imagename':imagename, 'type':'logo'},  //附加的参数,POST方式提交
			onCheckFileTypeExts:function(){   //文件类型不对的回调函数
				$("#alert_box_qrcode").jk_alert({msg:'文件类型错误!', type:'danger', show_time:8000});
			},
			onSelect: function(file){
				
			},
			onUploadStart:function(){  //开始上传的回调函数
				
			},
			onInit:function(){  //初始化的回调函数
				//美化上传框
				$('#input-file-config').ace_file_input({no_file:'点击选择文件 ...', btn_choose:'上传', btn_change:'修改', droppable:false});
			},
			onUploadComplete:function(){   //上传完成的回调函数
				//$("#alert_box_config").jk_alert({msg:'上传完成，正在升级，请稍候...', type:'success', show_time:8000});
			
			},
			onUploadSuccess:function(file, responseText){  //上传成功的回调函数
				var data = JSON.parse(responseText);

				if ( 1 == data.ret) { 
					$('#demo_logo').attr('src', '__PUBLIC__/'+data.data.savepath+data.data.savename).show();
					$('#logo').val(data.data.savename);
					fullbackuptab.formData = {'imagename':data.data.savename, 'type':'logo'};
				}else{
					$("#alert_box_qrcode").jk_alert({msg: data.msg, type:'danger', show_time:12000});
				}
			
			},
			onUploadError:function(file, responseText){
				$("#alert_box_qrcode").jk_alert({msg:responseText.msg, type:'danger', show_time:8000});
			}
		});
	});
</script>


<div class="page-content">
	<div class="row">
		<div class="col-xs-12"> 
			<form name="userForm1" id="userForm1" novalidate="" action="{:U('Config/save_website_config')}" method="post"> 
				<div class="form-horizontal">
					
					
					<div class="form-group" >
						<label class="col-sm-2 control-label no-padding-right margintop5" > 
							平台名称： 
						</label>
						<div class="col-sm-4">
							<div class="input-group col-xs-10 col-sm-12 ">
								<input type="text" id="pname_cn" name="pname_cn"  class="form-control" value="{$pname_cn}"/>
							</div>
							
						</div>
						<div class="help-block col-sm-6" >
							<span id="pname_cnTip"></span>
						</div>
					</div>
					<div class="form-group" >
						<label class="col-sm-2 control-label no-padding-right margintop5"> 
							平台版本号： 
						</label>
						<div class="col-sm-4">
							<div class="input-group col-xs-12">
								<input type="text" id="version_major" name="version_major" class="form-control" value="{$version_major}"/>
							</div>
						</div>
						<div class="help-block col-sm-6" >
							<span id="version_majorTip"></span>
						</div>
					</div>
					
					
				
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 control-label no-padding-right margintop5" for="form-field-5"> 
							平台地址：
						</label>
						<div class="col-sm-4">
							<div class="input-group col-xs-10 col-sm-12 ">
								<input type="text"  id="web_site" name="web_site" class="form-control" value="{$web_site}"/>
							</div>
							
						</div>
						<div class="help-block col-sm-6" >
							<span id="web_siteTip"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right margintop5" for="form-field-1"> 
							LOGO： 
						</label>
						<div class="col-sm-9">
							<div class="input-group col-xs-10 col-sm-6 ">
								<div id="config_upload_process"></div>
								<input type="hidden" name="logo" id="logo" value="{$logo}"> 
								<img id="demo_logo" src="__PUBLIC__/upload/logo/{$logo}" class="img-thumbnail col-xs-12 col-sm-4" style="<if condition="($logo eq '')">display:none;</if>" >
								<div class="space-4"></div>
								<div id="alert_box_qrcode"></div>
								<div style="clear:both;"></div>
								<p class="help-block dp">png/jpg/jpeg图片，小于500KB，分辨率建议宽度50px，高度27px</p>
							</div>

						</div>
					</div>

					
			
					<div class="form-group" >
						<label class="col-sm-2 control-label no-padding-right margintop5"> 
							平台底部版权： 
						</label>
						<div class="col-sm-10">
							<div class="input-group col-xs-10">
								<script id="editor" name="copyright_cn" type="text/plain" style="width:100%;height:200px;"></script>
							</div>
						</div>
						
					</div>
					
					<div id="alert_box"></div>
					<div class="clearfix form-actions">
						<div class="col-md-offset-3 col-md-9 col-sm-9">
							<button id="save" class="col-sm-2 btn btn-success" data-loading-text="正在提交,请稍候..." type="submit">
								<i class="icon-save bigger-110"></i>
							 	<span id="submitbutton">保存</span>
							</button>
							
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>